package basic.test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/7/30 22:59
 */
public class Main {

    static int count = 0;
    static int n;
    static int[] arr;
    static int[] flag;

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        n = Integer.parseInt(in.readLine());
        arr = new int[n + 1];
        flag = new int[n + 2];
        String[] temp = in.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            arr[i + 1] = Integer.parseInt(temp[i]);
        }
        solution(1);
        System.out.println(count);
    }

    private static void solution(int c){
        while(true){
            if(c == n + 1) break;
            flag[c]++;
            if((flag[c] & 1) == 1){
                c = arr[c];
            }else{
                c += 1;
            }
            count++;
        }
    }
}

